import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/views/Layout.vue'
import home from '@/views/home/index.vue'
import CategoryIndex from '@/views/category/index.vue'
import CategorySub from '@/views/category/sub.vue'
// 配置路由映射关系
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        component: home
      },
      { path: '/category/:id', component: CategoryIndex },
      { path: '/category/sub/:id', component: CategorySub }
    ]
  }
]

// 创建路由实例
const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
